﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Server.Conn;
using MySql.Data.MySqlClient;

namespace Server.Login
{
    public static class LoginConn
    {
        public static int CheckLogin(string usn, string pwd)
        {
            if (!ConnMgr.GetInstance().IsConnected())
            {
                return -1;
            }

            MySqlDataReader reader = ConnMgr.GetInstance().ExecuteReader("select uid from users where u_name = '" + usn + "' and u_pwd = '" + pwd + "'");
            if (reader != null && reader.Read())
            {
                return Int32.Parse(reader[0].ToString());
            }

            return -1;
        }
    }
}

